package yanivosher.aiproject;

import java.util.Scanner;

public class Main {

	public static void main(String[] args) {

		if (args.length > 1) {
			InputParser.parseFile(args[1]);
		}
		else {
			InputParser.parseFile("D:/Input.txt");
		}
		
		System.out.println(Environment.getInstance().toString());
		
		Scanner sc = new Scanner(System.in);
		System.out.print("Insert Agents number:");
	    int num = sc.nextInt();
	    
	    for (int i = 0; i < num; i++) {

			System.out.println("Insert Agent type for agent" + i + ":\n1: Human Agent\n2: Greedy Agent\n3: Terrorist Buster\n4: GreedyHeuristicAgent\n5: AstarHeuristicAgent\n6: RealTimeAstarHeuristicAgent");
		    int type = sc.nextInt();  

			System.out.print("Insert Agent Source for agent" + i + ":");
		    String source = sc.next();

			System.out.print("Insert Agent Destination for agent" + i + ":");
		    String destination = sc.next();
		    
			switch (type) {
			case 1:
				Environment.getInstance().agents.add(new HumanAgent(
						Environment.getInstance().graph.getVertexById(source), 
						Environment.getInstance().graph.getVertexById(destination)));
				break;
			case 2:
				Environment.getInstance().agents.add(new GreedyAgent(
						Environment.getInstance().graph.getVertexById(source), 
						Environment.getInstance().graph.getVertexById(destination)));
				break;
			case 3:
				Environment.getInstance().agents.add(new TerroristBuster(
						Environment.getInstance().graph.getVertexById(source), 
						Environment.getInstance().graph.getVertexById(destination)));
				break;
			case 4:
				Environment.getInstance().agents.add(new GreedyHeuristicAgent(
						Environment.getInstance().graph.getVertexById(source), 
						Environment.getInstance().graph.getVertexById(destination)));
				break;
			case 5:
				Environment.getInstance().agents.add(new AstarHeuristicAgent(
						Environment.getInstance().graph.getVertexById(source), 
						Environment.getInstance().graph.getVertexById(destination)));
				break;
			case 6:
				Environment.getInstance().agents.add(new RealTimeAstarHeuristicAgent(
						Environment.getInstance().graph.getVertexById(source), 
						Environment.getInstance().graph.getVertexById(destination)
						,800));
				break;

			default:
				break;
			}
		} 

	    //sc.close();
		System.out.println(Environment.getInstance().toString());

		System.out.println("Simulating!");
		Simulator.simulateWorld();
	}

}
